package com.css.fxfzcpxx.modules.hddcMap.controller;

import com.css.fxfzcpxx.base.response.RestResponse;
import com.css.fxfzcpxx.modules.hddcMap.entity.DrawingEntity;
import com.css.fxfzcpxx.modules.hddcMap.service.HddcMapService;
import com.css.fxfzcpxx.modules.hddcMap.vo.UpdateAttachVO;
import com.css.fxfzcpxx.modules.thematicMap.vo.OtherSystemInfoVo;
import com.css.fxfzcpxx.modules.thematicMap.entity.ThematicMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author y1fan
 * @description  活断层图  同步活断层系统生成活断层图
 */
@RestController
@RequestMapping("/hddcMap")
@Slf4j
public class HddcMapController {


    @Resource
    private HddcMapService hddcMapService;

    //最终出图接口   断层分布图
    @PostMapping("/save")
    public RestResponse save(OtherSystemInfoVo otherSystemInfoVo){
        RestResponse restResponse = null;
        try{
            hddcMapService.save(otherSystemInfoVo);
            restResponse =RestResponse.succeed("新增成功");
        }catch (Exception e){
            log.error("新增失败",e);
            restResponse = RestResponse.fail("新增失败!");
        }
        return restResponse;
    }


    //修改   只有图片的修改
    @PostMapping("/updateAttachVO")
    public RestResponse update(UpdateAttachVO updateAttachVO) {
        RestResponse response = null;
        try {
            hddcMapService.updateAttachVO(updateAttachVO);
            response = RestResponse.succeed();
        } catch (Exception e) {
            log.error("修改图片失败!", e);
            response = RestResponse.fail("修改图片失败!");
        }
        return response;
    }



    //删除
    @PostMapping("/delete/{ids}")
    public RestResponse delete(@PathVariable("ids") String ids) {
        RestResponse response = null;
        try {
            hddcMapService.delete(ids);
            response = RestResponse.succeed();
        } catch (Exception e) {
            log.error("删除失败!", e);
            response = RestResponse.fail("删除失败!");
        }
        return response;
    }





}
